﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Browser;

namespace DXTools.UI.Modules.ODataQueryDesigner
{
        public class AtomRequestCreator
        {
            #region IODataRequestCreator Members

            public WebRequest CreateGET(Uri requestUri)
            {
                WebRequest.RegisterPrefix(requestUri.OriginalString, WebRequestCreator.ClientHttp);
                HttpWebRequest getRequest = WebRequest.Create(requestUri) as HttpWebRequest;
                getRequest.Accept = "application/atom+xml, */*";
                return getRequest;
            }

            public WebRequest CreateGETFWithBrowserHttp(Uri requestUri)
            {
                WebRequest.RegisterPrefix(requestUri.OriginalString, WebRequestCreator.BrowserHttp);
                HttpWebRequest getRequest = WebRequest.Create(requestUri) as HttpWebRequest;
                return getRequest;
            }

            #endregion
        }

        public class JSONRequestCreator
        {
            #region IODataRequestCreator Members

            public WebRequest CreateGET(Uri requestUri)
            {
                WebRequest.RegisterPrefix(requestUri.OriginalString, WebRequestCreator.ClientHttp);
                HttpWebRequest getRequest = WebRequest.Create(requestUri) as HttpWebRequest;
                getRequest.Accept = "application/json, text/javascript, */*";

                return getRequest;
            }

            #endregion
        }
     





}